package com.copsoftware.struts.action;

import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;


import com.copsoftware.comun.assemblers.PersonaAssembler;
import com.copsoftware.comun.delegates.PersonaDelegate;
import com.copsoftware.mantenimientos.persona.beans.PersonaCompletaFlt;
import com.copsoftware.struts.forms.BaseActionForm;
import com.copsoftware.struts.forms.BusquedaPersonaForm;

public class BuscarPersonaCompletaAction extends BaseAction {

	@Override
	public ActionForward process(ActionMapping mapping,
			BaseActionForm baseForm, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		BusquedaPersonaForm form = (BusquedaPersonaForm) baseForm;
		PersonaDelegate personaDelegate = new PersonaDelegate();
		PersonaCompletaFlt personaCompletaFlt= PersonaAssembler.createPersonaCompletaFlt(form);
		Collection listaPersonas = personaDelegate.buscarPersonaCompleta(personaCompletaFlt);
		request.setAttribute("LISTA_DE_PERSONAS", listaPersonas);
		ActionForward nextPage = mapping.findForward("BUSCAR_PERSONA_FWD");
		return nextPage; 
	}

}
